package io2;

import java.io.*;

//对象流序列化
public class OOStudentDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Student zs=new Student();
        zs.setAge(65);
        zs.setGender("女");
        zs.setName("苏沐狼马蜂");
        zs.setOtherinfo(new String[]{"ohehehe","niniininin"});

        System.out.println(zs.toString());
        FileOutputStream fos=new FileOutputStream("student.nnn");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(zs);
oos.flush();
oos.close();
        FileInputStream fis=new FileInputStream("student.nnn");
        ObjectInputStream ois=new ObjectInputStream(fis);
        Student zshhe=(Student) (ois.readObject());
        ois.close();
      //  System.out.println();
        System.out.println(zshhe.toString());
    }
}
